/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Com.Login_Case;

import Com.Entity.Karyawan;
import SistemPenyewaanKamar.MenuMainForm;
import java.io.IOException;
import java.sql.SQLException;

/**
 *
 * @author Ardha
 */
public class LoginController {

    public void login(Karyawan karyawan, javax.swing.JFrame frame) throws SQLException, IOException, Exception {
        String passCek = Karyawan.getKoneksiKontrol().login(karyawan);
        if (passCek.equals(karyawan.getPassword())) {
            Karyawan.setUserID(karyawan);
            frame.setVisible(false);
            new MenuMainForm().setVisible(true);
        } else {
            throw new Exception(passCek);
        }
    }
}
